package com.huxiaohui.ssbx.config;

import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;


/**
 * 应用关闭配置
 */
@Configuration
@Slf4j
public class ShutdownConfig {

    @PreDestroy
    public void onShutdown() {
        log.info("应用正在关闭...");
        try {
            // 等待当前请求完成
            Thread.sleep(1000);
            log.info("应用已安全关闭");
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.warn("关闭过程被中断");
        }
    }
}
